<!DOCTYPE html>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="{$app_path}{$static_path}/css/site.css">
<div class="sjsWeb_HeaderTop">
		<div class="sjsWeb_HeaderTop_main">
			<div class="sjsWeb_HeaderTop_welcome">您好，欢迎来到米行！</div>
			<div class="header-account">
        <if condition="$_SESSION['uid']!=null">
            <a class="user-info btn" href="{:U('Survey/index')}" style="color:#FFA200;">用户：{$_SESSION['username']}&nbsp;&nbsp;ID：{$_SESSION['uid']} </a>      
            &nbsp;&nbsp;<a class="user-info btn" 
            href="{:U('Login/logout')}">注销</a>      
            <div class="clr"></div> 
        <else />
           <a class="btn" href="{:U('Login/index')}">登录</a>
            <a class="btn" href="{:U('Register/index')}">注册</a>
            <div class="clr"></div>
        </if>
        </div>
		</div>
	</div>
<div class="sjsWeb_HeaderMid">
		<div class="sjsWeb_HeaderMid_main">
			<div class="sjsWeb_TelSlide"></div>
			<div class="sjsWeb_HeaderMid_logo">
				<a href="/"><img src="{$app_path}{$static_path}/img/logo.png"></a>
			</div>
			<div class="sjsWeb_HeaderMid_Tel">
				<p class="p2">今日成交<span id="daynum" class="digits" style="color:#FFA200;font-size:18px;"></span>个</p>
				<p class="p2">成交总额:<span id="daymoney" class="digits" style="color:#FFA200;font-size:18px;"></span>元</p>
			</div>
			<div class="sjsWeb_HeaderMid_Tel">
				<p class="p2">历史成交<span id="allnum" class="digits" style="color:#FFA200;font-size:18px;"></span>个</p>
				<p class="p2">总成交额:<span id="allmoney" class="digits" style="color:#FFA200;font-size:18px;"></span>元</p>
			</div>
			<div class="sjsWeb_HeaderMid_Tel">
				<p class="p2">客服电话：</p>
				<p class="p2">0513-88699963</p>
			</div>
			<!-- 11-14 新增 -->
			<div class="sjsWeb_HeaderMid_Tel">
				<p class="p2">工作时间：</p>
				<p class="p2" style="color: #797979;font-size: 22px;">周一至周五 9:00-18:00</p>
			</div>
			<!-- 11-14 新增 end -->
		</div>
	</div>
<div class="sjsWeb_HeaderNav">
		<div class="sjsWeb_HeaderNav_main">
		<div class="NavWrap_start"></div>
			<ul class="NavWrap clearfix">
					<li id="index_li"><a href="{:U('Index/index')}" target="_self">首页</a>
					</li>
					<li id="center_li"><a href="{:U('Archive/index')}" target="_self">成交记录</a>
					</li>
					<li id="news_li"><a href="{:U('Survey/index')}" target="_self">个人中心</a>
					</li>
					<li id="pz_li"><a href="{:U('Credit/loaderInfo')}" target="_self">配资大厅</a>
					<ul class="topsubmenu" style="display:none;z-index:0;position: absolute;">
					<li style="width:112px;" class="sonli"><a href="{:U('Credit/loaderInfo')}">我要投资</a></li>
					<li style="width:112px;"class="sonli"><a href="{:U('Credit/investorinfo')}">我要借款</a></li>
				   </ul>
					</li>
					<li id="merchat_li"><a href="{:U('Contact/index')}" target="_self">联系方式</a>
					</li>
					<li id="help_li"><a href="{:U('Help/index')}" target="_self">帮助中心</a>
					</li>
			</ul>
		</div>
	</div>
	<style>
.topsubmenu li {
    background-color: #FF6524;
    color:#000000;
    min-width: 96px;
}
.sonli:hover{
	background-color: #FFA200;
}
	.digits{
		display:inline-block;
		height:20px;
		margin-left:3px;
		margin-right:3px;
	}
	.digits i{
		background:url({$app_path}{$static_path}/img/numbers.png) no-repeat;
		display:inline-block;
		float:left;
		height:30px;
		width:18px;
	}
	.digits b{
		background:url({$app_path}{$static_path}/img/numbers.png) no-repeat 0 -398px;
		display:inline-block;
		float:left;
		height:30px;
		width:10px;
	}
	</style>
<script type="text/javascript">
$(document).ready(function(){
	$(".NavWrap li").removeClass("curr");
	$(".NavWrap li a").each(function(index){
   	 if(window.location.href.indexOf($(this).attr("href")) >0){
    		$(this).parent().addClass("curr");
   	 };
    });
	if(window.location.href.indexOf('credit/') >0){
		$("#pz_li").addClass("curr");
	}
	$("#pz_li").mouseover(function(){
		$(".topsubmenu").css("display","block");
		$(".topsubmenu li").css("color","#fff");
	});
	$("#pz_li").mouseleave(function(){
		$(".topsubmenu").css("display","none");
	});
	refreshTra();
});

function refreshTra(){
	$.ajax({
		url:"{:U('Index/flushtra')}",
		dataType:'json',
		success:function(data){
			setNumber($("#daynum"), data.daytranum);
			setNumber($("#daymoney"), data.daytraprice);
			setNumber($("#allnum"), data.alltranum);
			setNumber($("#allmoney"), data.alltraprice);
		}
	});
	setTimeout(refreshTra, 20000);
}

function setNumber(dom, number){
	var n = String(number);
	var arrN=n.split('.');
	n=arrN[0];
	if(parseInt(arrN[1])>0){
		n=n+"."+arrN[1];
	}
	len = n.length;
	//如果新的数字短于当前的，要移除多余的i
	if(dom.find("i").length > len){
		dom.find("i:gt(" + (len - 1) + ")").remove();
	}
	//移除千分位分隔符
	dom.find("b").remove();
	//开始填充每一位
	for(var i=0;i<len;++i){
		//位数不足要补
		if(dom.find("i").length < len){
			dom.append("<i></i>");
		}
		var obj = dom.find("i").eq(i);
		var y = -40 * parseInt(n.charAt(i), 10);
		//加分隔符
		if(i < len - 1 && (len - i - 1) % 3 == 0)
			$("<b></b>").insertAfter(obj);
		//利用动画变换数字
		obj.animate({ backgroundPositionY:y+"px" }, 350);
	}
};
</script>